#define _CRT_SECURE_NO_WARNINGS 1
#include"Stack.h"

void test1()
{
	St pst;
	StInit(&pst);
	StPush(&pst, 5);
	StDataType a = StTop(&pst);
	StPop(&pst);
	printf("%d", a);
}

void test2()
{
	char* s = "010\010\\010\n";
	printf("%d", strlen(s));
}

void test3()
{
    St pst;
    StInit(&pst);
    char* s = "()";
    while (*s)
    {
        if (*s == '(' || *s == '[' || *s == '{')
        {
            StPush(&pst, *s);
        }
        else
        {
            if (StEmpty(&pst))
            {
                StDestroy(&pst);
                return false;
            }

            char a = StTop(&pst);
            StPop(&pst);
            if ((*s == ')' && a != '(')
                || (*s == ']' && a != '[')
                || (*s == '}' && a != '{'))
            {
                StDestroy(&pst);
                return false;
            }
        }
        s++;
    }
    bool ret = StEmpty(&pst);
}
int main()
{
	//test1();
	//test2();
    test3();
	return 0;
}